/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - resource
// Copyright( c) 2014.  All Rights Reserved
//
// File:		AEGPUProgramOGL.h
// Author:		Gianluca Belardelli
// Date:		12/12/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEGPUPROGRAMOGL_H_
#define _AEGPUPROGRAMOGL_H_

class AEGPUProgramOGL : public AEReferencedObject
{
// Members
public:
	struct AERegisterToUniformMappingEntry
	{
		AEINT32 	nRegister;
		AEINT32 	nUniform;
		AEUINT32 	uiUniformType;
		AEINT32		nSize;
	};

private:
	AEUINT32 m_uiShaderHandle;
	AETArray<AERegisterToUniformMappingEntry> m_arrRegToUniMappings;
	AEUINT32 m_uiNumMappings;

// Methods
public:
	AEGPUProgramOGL( void );
	~AEGPUProgramOGL( void );
	
	AEUINT32 LoadAndCompile( AEShaderStage eShaderStage, const AEShaderProgramResource *lpShaderProgramResource, const char *lpFileName );
	
	AE_FORCEINLINE AEUINT32 GetShaderHandle( void ) const;
	AE_FORCEINLINE void AddMapping( const AERegisterToUniformMappingEntry &refEntry );
	AE_FORCEINLINE const AETArray<AERegisterToUniformMappingEntry> &GetMappings( void ) const;
	AE_FORCEINLINE AEUINT32 GetNumMappings( void ) const;
	AE_FORCEINLINE void EnsureMappingSize( AEUINT32 uiSize );
	AE_FORCEINLINE AEUINT32 GetProgramHandle( void ) const;
	AE_FORCEINLINE AEBOOL32 IsCompiled( void ) const;
};

struct AEConstantToRegisterMappingInByteCode
{
	char szConstantName[128];
	AEINT32 nRegisterIndex;
};

#include "AEGPUProgramOGL.inl"

#endif // _AEGPUPROGRAMOGL_H_
